from random import randint

print('是否玩游戏：（y/n）')
k = input()
money = 0  # 钱
while k == 'y':

    if money >= 5:
        while money > 5:  # 有钱才能玩
            print('当前金币数：%d', money)
            t = input('是否继续：（y/n）')
            if t == 'y':
                myan = int(input('请下注：'))
                real = randint(1, 6) + randint(1, 6)
                print(real)
                if real == myan:
                    print('获胜！')
                    money += 5
                else:
                    print('失败！')
                    money -= 5
            elif t == 'n':
                print('go out!')
                exit()
    else:
        print('金币不足，请充值')
        money = money + int(input('请输入充值金额：'))
